<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "{{%article}}".
 *
 * @property integer $wid
 * @property string $title
 * @property string $author
 * @property string $content
 * @property string $image
 * @property integer $class_id
 * @property integer $yey_id
 * @property string $yey_xz
 * @property string $fb_time
 */
class Article extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%article}}';
    }


    /**
     * @return string
     */
    public function behaviors()
    {
        return [
            [
                'class'=>\app\components\behaviors\DatetimeBehavior::className(),
                'createDate'=>'fb_time',
            ],
        ];
    }
    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['title', 'author', 'content', 'class_id', 'yey_id', 'yey_xz', ], 'required'],
            [['content'], 'string'],
            [['class_id', 'yey_id'], 'integer'],
            [['fb_time'], 'safe'],
            [['title', 'author'], 'string', 'max' => 50],
            [['image'], 'string', 'max' => 200],
            [['yey_xz'], 'string', 'max' => 30],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'wid' => '主键',
            'title' => '标题',
            'author' => '对象',
            'content' => '正文',
            'image' => '图片/视频',
            'class_id' => '所属班级ID',
            'yey_id' => '所属幼儿园ID',
            'yey_xz' => '幼儿园类型/性质',
            'fb_time' => '发布时间',
        ];
    }
}
